<template>
    <div>
        我是b组件
        {{name}}
        {{num}}
        {{age10}}
        <button @click="setName">惦记我修改name</button>
    </div>
</template>

<script>
// mapState、mapGetters、mapMutations、mapAction 叫做vuex的辅助方法，帮咱们简化组件里获取和修改仓库里的数据
import {mapState,mapMutations} from "vuex"
export default {
    data(){
        return {
            age:10
        }
    },
    computed:{
        ...mapState(["name","num","age10"]),
      
    },
    methods:{
        ...mapMutations(["setName1"]),
        setName(){
            this.setName1("zhaoliu")
        }
    }
}
</script>

<style>

</style>